/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.openmrs.module.basicmodule.DSS.Interpreter;

import java.util.Date;

/**
 *
 * @author Stephen
 */
public class DSSObservation {
    private Date date;
    private Object value;
    private String concept, type;
    
    public DSSObservation(Date date, String concept, Object value, String type) {
        this.date = date;
        this.concept = concept;
        this.value = value;
        this.type = type;
    }
    
    public Date getDate() {
        return date;
    } 
    
    public Object getValue() {
        if (type.equalsIgnoreCase("Coded")) {
            return (String)value;
        } else if (type.equalsIgnoreCase("Numeric")) {
            return ((Double)value).floatValue();
        } else if (type.equalsIgnoreCase("boolean")) {
            return (Boolean)value;
        } else {
            return null;
        }
    }
    
    public String getConcept() {
        return concept;
    }
    
    public String getType() {
        return type;
    }
    
    @Override
    public String toString()
    {
           return "Name : "+concept+" Value : "+value+" Date : "+date.toString()+" Type : "+type;
    }
}
